import java.util.Arrays;

class Solution {
    //解法1：暴力解法
    public void merge(int[] nums1, int m, int[] nums2, int n) {
        for (int i = m,j = 0; i < m+n; i++,j++) {
            nums1[i] = nums2[j];
        }
        Arrays.sort(nums1);
    }
    public void merge2(int[] nums1, int m, int[] nums2, int n) {
        int len1 = m-1;
        int len2 = n-1;
        int len = m+n-1;
        while (len1>=0 && len2>=0) {
            nums1[len--] = nums1[len1] > nums2[len2] ? nums1[len1--] : nums2[len2--];
        }
        System.arraycopy(nums2,0,nums1,0,len2 + 1);
    }
}